<template>
  <div>
    <el-date-picker :disabled="!isEditable"  @change="onTimeChange" v-model="enterTime" type="month" placeholder="选择日期" format="yyyy 年 MM 月" value-format="yyyy-MM">
    </el-date-picker>
  </div>
</template>
<script>

export default {
  name: 'MyDatePicker',
  props: ["date","editable"],
  data() {
    return {
      enterTime:'',
      isEditable:true,
      pickerOptions0: {
        disabledDate(time) {
          return false;
        },
        month: 1
      }
    }
  },
  created:function(){
    if(this.date){
      this.enterTime = this.date
    }
    if(this.editable != null && this.editable != undefined){
      this.isEditable = this.editable
    }
  },
  methods:{
    getTime(){
      return this.enterTime
    },
    onTimeChange(time){
      this.enterTime = time
      this.$emit("timeChanged",time)
    }
  }

}
</script>